﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SaleDiscount.Portal.eBay;
using eBay.Service.Core.Sdk;

namespace SaleDiscount.Portal
{
    public partial class EBayFectchToken : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["sessionId"] != null && !string.IsNullOrEmpty(Session["sessionId"].ToString()) &&
       Session["CurrentUser"] != null && !string.IsNullOrEmpty(Session["CurrentUser"].ToString()))
                {
                    ApiContext context = eBaySession.LoadEmptyApiContext(Session["CurrentUser"].ToString());

                    //FetchToken
                    eBaySession.ActivateUser(context, Session["sessionId"].ToString(), Session["CurrentUser"].ToString(),-1);
                    Response.Redirect("~/SaleDiscountManagement.aspx");
                }
            }

        }
    }
}
